loadSelfScore()

score_list = ["write","listen1","listen2","read1","read2","read3","trans"]
score = new Object()
sumScore = 0
function loadSelfScore() {
    $.get("/score/api/get", function(data) {
        // 第一场为最新成绩
        // 计算总分
        score = JSON.parse(data[0].score)
        
        for (let i in score_list) {
            s = score[score_list[i]]
            if (s == "" || s == undefined) continue
            sumScore += parseFloat(s)
        }
        document.getElementById("score").innerHTML = (sumScore*7.1).toFixed(2)
    })
}


ELE = `
<div class="info-block" style="width: 350px;max-width: 400px; height: 600px;
    background: linear-gradient(to bottom right, #FF626E, #FFBE71);">
        <span class="title1111">具体小分</span>
        <div class="info-item">
            <div class="info-icon">
                <i class="
                icon
                mdui-icon
                material-icons
                mdui-text-color-white" style="font-size: 50px; text-align: center;">edit</i>
            </div>
            <label class="mdui-textfield-label label" style="color: white;">写作</label>
            <div id="write_point" class="tt">writewrite</div>
        </div>
        <div class="info-item">
            <div class="info-icon">
                <i class="
                icon
                mdui-icon
                material-icons
                mdui-text-color-white" style="font-size: 50px; text-align: center;">volume_down</i>
            </div>
            <label class="mdui-textfield-label label" style="color: white;">听力1</label>
            <div id="listen1_point" class="tt">listen1listen1</div>
        </div>
        <div class="info-item">
            <div class="info-icon">
                <i class="
                icon
                mdui-icon
                material-icons
                mdui-text-color-white" style="font-size: 50px; text-align: center;">volume_up</i>
            </div>
            <label class="mdui-textfield-label label" style="color: white;">听力2</label>
            <div id="listen2_point" class="tt">listen2listen2</div>
        </div>
        <div class="info-item">
            <div class="info-icon">
                <i class="
                icon
                mdui-icon
                material-icons
                mdui-text-color-white" style="font-size: 50px; text-align: center;">dns</i>
            </div>
            <label class="mdui-textfield-label label" style="color: white;">选词填空</label>
            <div id="read1_point" class="tt">read1read1</div>
        </div>
        <div class="info-item">
            <div class="info-icon">
                <i class="
                icon
                mdui-icon
                material-icons
                mdui-text-color-white" style="font-size: 50px; text-align: center;">dashboard</i>
            </div>
            <label class="mdui-textfield-label label" style="color: white;">长篇阅读</label>
            <div id="read2_point" class="tt">read2read2</div>
        </div>
        <div class="info-item">
            <div class="info-icon">
                <i class="
                icon
                mdui-icon
                material-icons
                mdui-text-color-white" style="font-size: 50px; text-align: center;">chrome_reader_mode</i>
            </div>
            <label class="mdui-textfield-label label" style="color: white;">仔细阅读</label>
            <div id="read3_point" class="tt">read3read3</div>
        </div>
        <div class="info-item">
            <div class="info-icon">
                <i class="
                    icon
                    mdui-icon
                    material-icons
                    mdui-text-color-white" style="font-size: 50px; text-align: center;">g_translate</i></div>
            <label class="mdui-textfield-label label" style="color: white;">翻译</label>
            <div id="read3_point" class="tt">transtrans</div>
        </div>
        <div class="info-item">
            <div class="info-icon">
                <i class="
                icon
                mdui-icon
                material-icons
                mdui-text-color-white" style="font-size: 50px; text-align: center;">data_usage</i>
            </div>
            <label class="mdui-textfield-label label" style="color: white;">总分</label>
            <div id="read3_point" class="tt">sum0sum0</div>
        </div>
        <div class="info-item">
            <div class="info-icon">
                <i class="
                    icon
                    mdui-icon
                    material-icons
                    mdui-text-color-white" style="font-size: 50px; text-align: center;">data_usage</i>
            </div>
            <label class="mdui-textfield-label label" style="color: white;">总分</label>
            <div id="sum1_point" class="tt">sum1sum1</div>
                                                                                                                                                </div>
    </div>
    `
function onGuakai() {
    for (let i in score_list) {
        ELE = ELE.replaceAll(score_list[i]+score_list[i],score[score_list[i]])
    }
    ELE = ELE.replaceAll("sum0sum0",sumScore)
    ELE = ELE.replaceAll("sum1sum1",(sumScore*7.1).toFixed(2))
    console.log(s)
    document.getElementById("allScore").innerHTML = ELE
}